﻿using System;
using System.Collections.Generic;
using viForum.Classes;
using viForum.Controllers;
using visinia.SmartEngine;
using visinia.SmartEngine.Modules;

public partial class Modules_viForum_LatestForumPosts_LatestForumPosts : WebModule
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int count = 0;
        if (Int32.TryParse((string)Settings["Count"], out count))
        {
            List<Thread> list = ThreadController.GetLatestForumThreads(count);
            LatestPostsList.DataSource = list;
            LatestPostsList.DataBind();
        }
    }

    public string TrimContent(string Content)
    {
        if (Content.Length > 70)
            return WebHelpers.StripHtml(Content.Remove(70)) + "...";
        return WebHelpers.StripHtml(Content);
    }
}

